﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;


namespace m10cde_WinForms.Hiscore
{
    
    public class Score : IComparable{
        [XmlElement("Name")]
        public String name { get; set; }
        [XmlElement("Score")]
        public String score { get; set; }
        [XmlElement("Date")]
        public String date;

        public Score(String name, String score){
            this.name = name;
            this.score = score;
            this.date = DateTime.Today.ToLongDateString();
        }

        /// <summary>
        /// Empty constructor
        /// </summary>
        public Score(){
            this.date = DateTime.Today.ToLongDateString();
        }


        /// <summary>
        /// pretty basic tostring method
        /// </summary>
        /// <returns>a string of this objects contents</returns>
        public String toString()
        {
            return name + " " + score + " " + date + System.Environment.NewLine;
        }

        public int CompareTo(object obj){
            Score Compare = (Score)obj;
            int result = this.score.CompareTo(Compare.score);
            if (result == 0)
                result = this.score.CompareTo(Compare.score);
            return result;
        }


        /*       private Score(String name, String Score){
                      //create a var with todays date and time in it
                   this.name = name;
                   this.score = Score;
                   this.date = myDate.ToString();
               }*/

    }

}
